/**
 * @param {number[]} nums
 * @param {number} val
 * @return {number}
 */
var removeElement = function (nums, val) {
  let fast = 1
  let slow = 0
  while (fast < nums.length) {
    if (nums[slow] !== val) slow++
    nums[slow] = nums[fast]
    fast++
  }
  nums[nums.length - 1] !== val && slow++
  return slow
}
console.log(removeElement([2], 3))
